class Solution(object):
    def maxDepth(self, s):
        t = 0
        max_len = 0
        for c in s:
            if c == '(':
                t += 1
                max_len = max(t, max_len)
            if c == ')':
                t -= 1
        return max_len